package com.itmk.system.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itmk.system.home.vo.UserInfoRespVO;
import com.itmk.system.user.entity.SysUser;
import com.itmk.vo.req.UserReqVO;
import com.itmk.vo.resp.UserInfoWithWechatInfoRespVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface SysUserMapper extends BaseMapper<SysUser> {

    IPage<SysUser> getUserWithRoleList(IPage<SysUser> page, @Param("userReqVO")UserReqVO userReqVO);

    @Select("select contact.contact_id,username,login_name,nickname,openid,enabled,headimgurl from user inner join contact " +
            "on user.contact_id=contact.contact_id where user.id=#{userId}")
    UserInfoWithWechatInfoRespVO getUserInfoWithWechatInfo(Integer userId);

    @Select("select id,username,is_admin,login_name,headimgurl,nickname from user " +
            "join contact on user.contact_id= contact.contact_id where id=#{userId}")
    UserInfoRespVO getUserInfoByUserId(@Param("userId") Long userId);
}
